home *** CD-ROM | disk | FTP | other *** search
- unit MenuFix;
-
- interface
-
- implementation
-
- uses
- SysUtils, Forms, Messages, Controls;
-
- type
- TFixMyMenus = class
- private
- function DoAppMessage(var Msg: TMessage): Boolean;
- public
- constructor Create;
- destructor Destroy; override;
- end;
-
- constructor TFixMyMenus.Create;
- begin
- inherited Create;
- Application.HookMainWindow(DoAppMessage)
- end;
-
- destructor TFixMyMenus.Destroy;
- begin
- Application.UnhookMainWindow(DoAppMessage);
- inherited Destroy
- end;
-
- function TFixMyMenus.DoAppMessage(var Msg: TMessage): Boolean;
- begin
- Result := (Msg.Msg = cm_AppSysCommand)
- {$ifndef CompletelyStopMenuRedirections}
- and (Screen.ActiveForm.Menu <> nil)
- {$endif}
- end;
-
- const
- Obj: TFixMyMenus = nil;
-
- procedure MyExitProc; far;
- begin
- if Assigned(Obj) then
- Obj.Free
- end;
-
- {$ifdef Ver80} {Delphi 1.0x}
- {$define DodgyMenus}
- {$endif}
- {$ifdef Ver90} {Delphi 2.0x}
- {$define DodgyMenus}
- {$endif}
- {$ifdef Ver93} {C++ Builder 1.0x}
- {$define DodgyMenus}
- {$endif}
-
- initialization
- {$ifdef DodgyMenus}
- AddExitProc(MyExitProc);
- Obj := TFixMyMenus.Create
- {$endif}
- end.